﻿// See https://aka.ms/new-console-template for more information
using System.Net;
using System;
using System.Net.NetworkInformation;
using DoNet.Common.Helpers;

Console.WriteLine("Hello, World!");



string appId = Guid.NewGuid().ToString("N").Substring(0, 18); // 截取18位

Console.WriteLine(appId);

string prefix = "wt"; // 系统标识常量
string timestamp = DateTime.Now.ToString("yyyyMMddHHmmss");
string random = new Random().Next(1000, 9999).ToString();
string appId1 = $"{prefix}{timestamp}{random}".Substring(0, 18);
Console.WriteLine(appId1);


try
{
    var isConnect = DomainHelper.GetDomainConnect("api.weixin.qq.com", 443);
    Console.WriteLine(isConnect);

    //HttpWebRequest req = (HttpWebRequest)WebRequest.Create("https://api.weixin.qq.com");
    //req.Method = "HEAD"; // 或"GET"
    //req.Timeout = 10000;
    //using (HttpWebResponse resp = (HttpWebResponse)req.GetResponse())
    //{
    //    Console.WriteLine(resp.StatusCode == HttpStatusCode.OK);
    //}
}
catch { Console.WriteLine(false); }